package com.dgshanger.sanhxiaofeisc.mvp.model

import com.dgshanger.sanhxiaofeisc.common.AppApi
import com.dgshanger.sanhxiaofeisc.entity.HomeEntity
import com.dgshanger.sanhxiaofeisc.entity.NearbyItemEntity
import com.dgshanger.sanhxiaofeisc.mvp.contract.NearbyContract
import com.xx.baseutilslibrary.network.rx.RxHelper
import com.xx.baseutilslibrary.network.rx.XxBaseHttpObserver

/**
 * NearbyModel
 * 沉迷学习不能自拔
 * Describe：
 * Created by 雷小星🍀 on 2018/4/19 10:39.
 */

class NearbyModel : NearbyContract.Model {

    override fun loadCategory(httpObserver: XxBaseHttpObserver<List<HomeEntity.CategoryListBean>>) {

    }

    override fun loadMerchant(location_name: String?, sort_distance: String?, user_longitude: String?, user_latitude: String?, page: String?, sort_new: String?, sort_comment: String?, httpObserver: XxBaseHttpObserver<MutableList<NearbyItemEntity>>?) {
        AppApi.Api().getNearbyData(location_name,sort_distance,user_longitude,
                user_latitude,page,sort_new,sort_comment)
                .compose(RxHelper.io_main())
                .compose(RxHelper.start_finish(httpObserver))
                .subscribe(httpObserver)
    }


}
